<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>光大银行BDAP平台问题查询系统</title>

    <link rel="stylesheet" href="http://cdn.bootcss.com/twitter-bootstrap/3.0.1/css/bootstrap.min.css">
    <link rel="stylesheet" href="http://cdn.bootcss.com/twitter-bootstrap/3.0.1/css/bootstrap-theme.min.css">
    <!-- <script src="https://code.jquery.com/jquery-1.7.2.min.js"></script>-->
    <!--<script src="http://cdn.bootcss.com/twitter-bootstrap/3.0.1/js/bootstrap.min.js"></script>-->
    <script type="text/javascript" src="/js/jquery-1.7.2.min.js"></script>
    <style>
        .bs-docs-home
        {
            background-color: white;
        }

        .name{
            float: right;
            margin-left:30px;
            margin-right:10px;
            font-style: italic;
        }

        .logout{
            width: 50px;
            float: right;
        }

        .input-group{
            display:flex;
            width: 730px;
        }

        .glyphicon{
            width: 600px;
            height:30px;
            margin-left:10px;
        }

        .form-control{
            margin-left:10px;
            width: 100px;
        }

    </style>
</head>

<body class="bs-docs-home">
<div class=".container-fluid theme-showcase">
    <div class="row">
        <div class="col-sm-8"></div>
        <div class="col-sm-14">
            <div class="panel panel-primary">
                <div class="panel-heading">
                    <h3 class="panel-title"><strong>光大银行BDAP平台问题解决</strong></h3>
                </div>
                <div class="panel-body">
                    <form method="post" action="">
                        <div class="form-group">
                            <label form="Subject">请输入对应的解决方案</label>
                            <div class="input-group" id="inputone">
                                <input type="text" class="form-control" id="Subjectthree" name="Subjectthree" placeholder="请输入更新编号">
                                <input type="text" class="form-control" id="Subjecttwo" name="Subjecttwo" placeholder="请输入解决方案">
                                <button type="button" class="glyphicon glyphicon-plus" id="subone">更新解决方案</button>
                                <select class="form-control" id="Subjectone">
                                    <option>请选择所属类别</option>
                                    <option value="0">未解决</option>
                                    <option value="1">已解决</option>
                                    <option value="2">解决中</option>
                                </select>
                                <button type="button" class="glyphicon glyphicon-plus" id="subtwo">更新解决状态</button>
                            </div>
                        </div>
                    </form>
                    <div class="table-responsive">
                        <table  border="0" cellspacing="0" cellpadding="0" class="table">
                            <tr class=" label-primary">
                                <th scope="col"><span style="color:white">编号</span></th>
                                <th scope="col"><span style="color:#ffffff">所属类别</span></th>
                                <th scope="col"><span style="color:white">报错信息</span></th>
                                <th scope="col"><span style="color:white">提问人</span></th>
                                <th scope="col"><span style="color:white">所属部门</span></th>
                                <th scope="col"><span style="color:white">是否解决</span></th>
                                <th scope="col"><span style="color:white">解决方案</span></th>
                            </tr>

                            <tbody id="tbodydata">

                            </tbody>

                        </table>
                        <div align="center">
                            <ul class="pagination" id="tbodydata2">
                                <li><a class="leftindex" herf="#"><input type="hidden" class="leftindexinput" value="1">&laquo;</a></li>
                                <li><a class="firstpage" herf="#"><input type="hidden" class="firstpageinput" value="1">首页</input></a></li>
                                <li><a herf="#"><span class="ctpage" id="ctpage">0</span></a></li>
                                <li><a class="lasttpage" herf="#"><input type="hidden" class="lastpageinput" value="1"/>尾页</a></li>
                                <li><a class="rightindex" herf="#"><input type="hidden" class="rightindexinput" value="1"/>&raquo;</a></li>
                            </ul>
                        </div>
                        当前页 <a herf="#"><input type="button" class="currentPage" value="0" readonly="readonly"/></a>
                        共<a herf="#"><input type="button" class="totalPage" value="0" readonly="readonly"/></a>页
                        每页显示<a herf="#"><input type="button" class="everyPage" value="0" readonly="readonly"/></a>条
                        总记录数<a herf="#"><input type="button" class="totalCount" value="0" readonly="readonly"/></a>条
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>
<script type="text/javascript">
    var httpUrl = "http://localhost:8080";
    $("#subone").click(function testRestfulPostone(){
        var datasone = {id:$("#Subjectthree").val(),result:$("#Subjecttwo").val(), start: 0,end: 10};
        $.ajax({
            type: "POST",
            url: httpUrl + "/updateResultData",
            dataType:"json",
            data: JSON.stringify(datasone),
            contentType:"application/json;charset=utf-8",
            success:function (data) {
                var str="";
                var fg="";
                for (i in data) {
                    if (data["pagecount"] != data[i]) {
                        if (data[i].flag == 0) {
                            fg = "未解决";
                        } else if (data[i].flag == 1) {
                            fg = "已解决";
                        } else {
                            fg = "解决中";
                        }
                        str += "<tr class=\"label-primary\">" +
                            "<th scope=\"col\"><span style=\"color:black\">" + data[i].id + "</span></th>" +
                            "<th scope=\"col\"><span style=\"color:black\">" + data[i].type + "</span></th>" +
                            "<th scope=\"col\"><span style=\"color:black\">" + data[i].message + "</span></th>" +
                            "<th scope=\"col\"><span style=\"color:black\">" + data[i].user + "</span></th>" +
                            "<th scope=\"col\"><span style=\"color:black\">" + data[i].emp + "</span></th>" +
                            "<th scope=\"col\"><span style=\"color:black\">" + fg + "</span></th>" +
                            "<th scope=\"col\"><span style=\"color:black\">" + data[i].result + "</span></th>" +
                            "</tr>";
                    }
                }
                document.getElementById("tbodydata").innerHTML=str;
                var totalCount = data["pagecount"].result;
                $(".totalCount").attr("value", totalCount);
                var totalPage = totalCount%10==0 ? totalCount/10 : Math.floor(totalCount/10)+1;
                $(".totalPage").attr("value", totalPage);
                $(".currentPage").attr("value", 1);
                $(".everyPage").attr("value", 10);
                $(".ctpage").html("1");
            }
        })
    })

    $("#subtwo").click(function testRestfulPosttwo(){
        var datastwo = {id:$("#Subjectthree").val(),flag:$("#Subjectone").val(), start: 0,end: 10};
        $.ajax({
            type: "POST",
            url: httpUrl + "/updateResultDataflag",
            dataType:"json",
            data: JSON.stringify(datastwo),
            contentType:"application/json;charset=utf-8",
            success:function (data) {
                var str="";
                var fg="";
                for (i in data) {
                    if (data["pagecount"] != data[i]) {
                        if (data[i].flag == 0) {
                            fg = "未解决";
                        } else if (data[i].flag == 1) {
                            fg = "已解决";
                        } else {
                            fg = "解决中";
                        }
                        str += "<tr class=\"label-primary\">" +
                            "<th scope=\"col\"><span style=\"color:black\">" + data[i].id + "</span></th>" +
                            "<th scope=\"col\"><span style=\"color:black\">" + data[i].type + "</span></th>" +
                            "<th scope=\"col\"><span style=\"color:black\">" + data[i].message + "</span></th>" +
                            "<th scope=\"col\"><span style=\"color:black\">" + data[i].user + "</span></th>" +
                            "<th scope=\"col\"><span style=\"color:black\">" + data[i].emp + "</span></th>" +
                            "<th scope=\"col\"><span style=\"color:black\">" + fg + "</span></th>" +
                            "<th scope=\"col\"><span style=\"color:black\">" + data[i].result + "</span></th>" +
                            "</tr>";
                    }
                }
                document.getElementById("tbodydata").innerHTML=str;
                var totalCount = data["pagecount"].result;
                $(".totalCount").attr("value", totalCount);
                var totalPage = totalCount%10==0 ? totalCount/10 : Math.floor(totalCount/10)+1;
                $(".totalPage").attr("value", totalPage);
                $(".currentPage").attr("value", 1);
                $(".everyPage").attr("value", 10);
                $(".ctpage").html("1");
            }
        })
    })

    $(".leftindex").click(function (){
        var leftindexinput = $(".leftindexinput").attr("value");
        var ctpage = document.getElementById("ctpage").innerText;
        if(ctpage>1){
            var datas = {mess: $("#submitone").attr("value"), start: (ctpage-1)*10-10,end:10};
            $.ajax({
                type: "POST",
                url: httpUrl + "/addResultDataShow",
                dataType: "json",
                data: JSON.stringify(datas),
                contentType: "application/json;charset=utf-8",
                success: function (data) {
                    var str="";
                    var fg="";
                    for (i in data) {
                        if (data["pagecount"] != data[i]) {
                            if (data[i].flag == 0) {
                                fg = "未解决";
                            } else if (data[i].flag == 1) {
                                fg = "已解决";
                            } else {
                                fg = "解决中";
                            }
                            str += "<tr class=\"label-primary\">" +
                                "<th scope=\"col\"><span style=\"color:black\">" + data[i].id + "</span></th>" +
                                "<th scope=\"col\"><span style=\"color:black\">" + data[i].type + "</span></th>" +
                                "<th scope=\"col\"><span style=\"color:black\">" + data[i].message + "</span></th>" +
                                "<th scope=\"col\"><span style=\"color:black\">" + data[i].user + "</span></th>" +
                                "<th scope=\"col\"><span style=\"color:black\">" + data[i].emp + "</span></th>" +
                                "<th scope=\"col\"><span style=\"color:black\">" + fg + "</span></th>" +
                                "<th scope=\"col\"><span style=\"color:black\">" + data[i].result + "</span></th>" +
                                "</tr>";
                        }
                    }
                    document.getElementById("tbodydata").innerHTML = str;
                }
            })
            ctpage = ctpage - leftindexinput;
            $(".ctpage").html(ctpage);
            $(".currentPage").attr("value", ctpage);
        }
    })

    $(".rightindex").click(function (){
        var totalPage = $(".totalPage").attr("value");
        var rightindexinput = $(".rightindexinput").attr("value");
        var ctpage = document.getElementById("ctpage").innerText;
        if(ctpage<totalPage){
            var datas = {mess: $("#submitone").attr("value"), start: (ctpage-1)*10+1*10,end:10};
            $.ajax({
                type: "POST",
                url: httpUrl + "/addResultDataShow",
                dataType: "json",
                data: JSON.stringify(datas),
                contentType: "application/json;charset=utf-8",
                success: function (data) {
                    var str="";
                    var fg="";
                    for (i in data) {
                        if (data["pagecount"] != data[i]) {
                            if (data[i].flag == 0) {
                                fg = "未解决";
                            } else if (data[i].flag == 1) {
                                fg = "已解决";
                            } else {
                                fg = "解决中";
                            }
                            str += "<tr class=\"label-primary\">" +
                                "<th scope=\"col\"><span style=\"color:black\">" + data[i].id + "</span></th>" +
                                "<th scope=\"col\"><span style=\"color:black\">" + data[i].type + "</span></th>" +
                                "<th scope=\"col\"><span style=\"color:black\">" + data[i].message + "</span></th>" +
                                "<th scope=\"col\"><span style=\"color:black\">" + data[i].user + "</span></th>" +
                                "<th scope=\"col\"><span style=\"color:black\">" + data[i].emp + "</span></th>" +
                                "<th scope=\"col\"><span style=\"color:black\">" + fg + "</span></th>" +
                                "<th scope=\"col\"><span style=\"color:black\">" + data[i].result + "</span></th>" +
                                "</tr>";
                        }
                    }
                    document.getElementById("tbodydata").innerHTML = str;
                }
            })
            ctpage = ctpage*1 + rightindexinput*1;
            $(".ctpage").html(ctpage);
            $(".currentPage").attr("value", ctpage);
        }
    })

    $(".firstpage").click(function (){
        var firstpageinput = $(".firstpageinput").attr("value");
        var ctpage = document.getElementById("ctpage").innerText;
        if(ctpage!=1&&ctpage!=0) {
            var datas = {mess: $("#submitone").attr("value"), start: 0,end:10};
            $.ajax({
                type: "POST",
                url: httpUrl + "/addResultDataShow",
                dataType: "json",
                data: JSON.stringify(datas),
                contentType: "application/json;charset=utf-8",
                success: function (data) {
                    var str="";
                    var fg="";
                    for (i in data) {
                        if (data["pagecount"] != data[i]) {
                            if (data[i].flag == 0) {
                                fg = "未解决";
                            } else if (data[i].flag == 1) {
                                fg = "已解决";
                            } else {
                                fg = "解决中";
                            }
                            str += "<tr class=\"label-primary\">" +
                                "<th scope=\"col\"><span style=\"color:black\">" + data[i].id + "</span></th>" +
                                "<th scope=\"col\"><span style=\"color:black\">" + data[i].type + "</span></th>" +
                                "<th scope=\"col\"><span style=\"color:black\">" + data[i].message + "</span></th>" +
                                "<th scope=\"col\"><span style=\"color:black\">" + data[i].user + "</span></th>" +
                                "<th scope=\"col\"><span style=\"color:black\">" + data[i].emp + "</span></th>" +
                                "<th scope=\"col\"><span style=\"color:black\">" + fg + "</span></th>" +
                                "<th scope=\"col\"><span style=\"color:black\">" + data[i].result + "</span></th>" +
                                "</tr>";
                        }
                    }
                    document.getElementById("tbodydata").innerHTML = str;
                }
            })
            $(".ctpage").html(firstpageinput);
            $(".currentPage").attr("value", firstpageinput);
        }
    })

    $(".lasttpage").click(function (){
        var totalPage = $(".totalPage").attr("value");
        var ctpage = document.getElementById("ctpage").innerText;
        if(0<ctpage<totalPage){
            var datas = {mess: $("#submitone").attr("value"), start: (totalPage-1)*10,end:10};
            $.ajax({
                type: "POST",
                url: httpUrl + "/addResultDataShow",
                dataType: "json",
                data: JSON.stringify(datas),
                contentType: "application/json;charset=utf-8",
                success: function (data) {
                    var str="";
                    var fg="";
                    for (i in data) {
                        if (data["pagecount"] != data[i]) {
                            if (data[i].flag == 0) {
                                fg = "未解决";
                            } else if (data[i].flag == 1) {
                                fg = "已解决";
                            } else {
                                fg = "解决中";
                            }
                            str += "<tr class=\"label-primary\">" +
                                "<th scope=\"col\"><span style=\"color:black\">" + data[i].id + "</span></th>" +
                                "<th scope=\"col\"><span style=\"color:black\">" + data[i].type + "</span></th>" +
                                "<th scope=\"col\"><span style=\"color:black\">" + data[i].message + "</span></th>" +
                                "<th scope=\"col\"><span style=\"color:black\">" + data[i].user + "</span></th>" +
                                "<th scope=\"col\"><span style=\"color:black\">" + data[i].emp + "</span></th>" +
                                "<th scope=\"col\"><span style=\"color:black\">" + fg + "</span></th>" +
                                "<th scope=\"col\"><span style=\"color:black\">" + data[i].result + "</span></th>" +
                                "</tr>";
                        }
                    }
                    document.getElementById("tbodydata").innerHTML = str;
                }
            })
            $(".ctpage").html(totalPage);
            $(".currentPage").attr("value", totalPage);
        }
    })

    $(function(){
        $.ajax({
            type: "POST",
            url: httpUrl + "/addResultDataShow",
            dataType: "json",
            data: JSON.stringify({a:1, start: 0,end: 10}),
            contentType:"application/json;charset=utf-8",
            success: function (data) {
                var str = "";
                var fg ="";
                for (i in data) {
                    if (data["pagecount"] != data[i]) {
                        if (data[i].flag == 0) {
                            fg = "未解决";
                        } else if (data[i].flag == 1) {
                            fg = "已解决";
                        } else {
                            fg = "解决中";
                        }
                        str += "<tr class=\"label-primary\">" +
                            "<th scope=\"col\"><span style=\"color:black\">" + data[i].id + "</span></th>" +
                            "<th scope=\"col\"><span style=\"color:black\">" + data[i].type + "</span></th>" +
                            "<th scope=\"col\"><span style=\"color:black\">" + data[i].message + "</span></th>" +
                            "<th scope=\"col\"><span style=\"color:black\">" + data[i].user + "</span></th>" +
                            "<th scope=\"col\"><span style=\"color:black\">" + data[i].emp + "</span></th>" +
                            "<th scope=\"col\"><span style=\"color:black\">" + fg + "</span></th>" +
                            "<th scope=\"col\"><span style=\"color:black\">" + data[i].result + "</span></th>" +
                            "</tr>";
                    }
                }
                document.getElementById("tbodydata").innerHTML = str;
                var totalCount = data["pagecount"].result;
                $(".totalCount").attr("value", totalCount);
                var totalPage = totalCount%10==0 ? totalCount/10 : Math.floor(totalCount/10)+1;
                $(".totalPage").attr("value", totalPage);
                $(".currentPage").attr("value", 1);
                $(".everyPage").attr("value", 10);
                $(".ctpage").html("1");
            }
        })
    })

    document.onkeydown = function () {

        if (event.keyCode === 13) {

            event.returnValue = false;

            event.cancel = true;

            $("#submitone").click();

        }

    }
</script>